package day10_io_code.com.itheima.d2_buffer_stream;

import java.io.*;

public class TimeTest5 {
    public static final String SRC_VIDEO = "D:\\sziitheima1\\day02-面向对象进阶(二)\\视频\\11、接口的综合案例.avi";
    public static final String DEST_PATH = "E:\\resource\\";
    public static void main(String[] args) {

    }
    public static void copy04(){
        long start = System.currentTimeMillis();

        try(
                InputStream is = new FileInputStream(SRC_VIDEO);
                InputStream bis = new BufferedInputStream(is);

                OutputStream os = new FileOutputStream(DEST_PATH + "11、接口的综合案例.avi");
                BufferedOutputStream bos = new BufferedOutputStream(os);

        ){
            byte[] buffer = new byte[32 * 1024];
            int len;
            while ((len = bis.read(buffer)) != -1){
                bos.write(buffer, 0, len);
            }
        }catch (Exception e){
            e.printStackTrace();
        }

        long end = System.currentTimeMillis();
        System.out.println("复制完成，耗时：" + (end - start) + "毫秒");
    }
}
